package com.inspect;

import java.util.Date;
import java.util.HashMap;

import org.apache.log4j.Logger;

import com.inspect.log.LogSingleton;
import com.inspect.quartz.JobSchedule;

public class Inspect_quantz {

	Logger log = LogSingleton.get_logger(Inspect_quantz.class);

	public void run() {
		JobSchedule jobSchedule = new JobSchedule();
		// 启动调度器
		jobSchedule.startScheduler();
		try {
			if (JobSchedule.getSchedulerInstance().getJobGroupNames().length <= 0) {
				// 构造调度管理者
				DailyJob bj = new DailyJob();
				bj.clearTaskChange();
				String corntime = "0 */1 * * * ?";//config.get("dailyJob_inspectTime");

				if (corntime != null && corntime != "") {
					// 添加job
					jobSchedule.addJob("dailyJob", "pollerGroup",
							"dailyTrigger", "pollerTriggerGroup",
							bj.getClass(), corntime,new Date(),
							new HashMap<String, String>());
				} else {
					log.info("请确认app.xml配置文件中的轮询时间不为空!!");
				}
			}
		} catch (Exception e) {
			log.error("it has Exception when run poller", e);
		}
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		(new Inspect_quantz()).run();
	}
}
